*-----------------------------------------------------------------
version 10
cap clear
cap log close
set more off
cd "E:\REStat_MS14767_Vol96(2)\Data preparation Compustat"
log using "1.cleancompustat.log", replace
*-----------------------------------------------------------------

set mem 700m
set mat 2000

**********************************
* This file is supposed to solve the problem with double entries 
* in the compustat database. Mainly canadian firms are affected
* by this procedure. Which entry is to be kept depends on the information
* the entry may deliver. 
* The resulting file clean_compustat_master contains all
* firms but no doubles.
* The correction of sales is not included.
**************************************

use "master_compustat_all_countries.dta"
* this is the full compustat database (version ?? of ??)
* THe data cannot be make avaiable

order ticker year CUSIP name sales employees
so CUSIP year

count if CUSIP==CUSIP[_n-1] & year==year[_n-1]
* we have 5236 entries with the same CUSIP and Year, which has to be cleaned upo


*********************************************
* Tickers with a "3" in front mean, that those
* titles are only traded over the counter OR that
* those firms were delisted from NASDAQ. 
* Tickers with a "." in the end mean, that those
* tickers might belong to different firms in Canada
* and US and therefore the Canadian firm gets the "."
* OR that one firm is active and the other on in only 
* available for research.
**************************************************

gen droplater=.
qui replace droplater=1 if ticker=="ADY." /* ADB SYSTEMS INTL LTD, surviving ticker: 3ADBYF */
qui replace droplater=1 if ticker=="ATY." /* ATI TECHNOLOGIES INC, surviving ticker: ATYT */
qui replace droplater=1 if ticker=="ABZ" /* ABER DIAMOND CORP, surviving ticker: ABER */
qui replace droplater=1 if ticker=="A." /* ABITIBI CONSOLIDATED INC, surviving ticker: ABY */
qui replace droplater=1 if ticker=="ACE.B" /* ACE AVIATION HOLDINGS INC, surviving ticker: ACEBF */
qui replace droplater=1 if ticker=="AHX" /* ADHEREX TECHNOLOGIES INC, surviving ticker: ADH */
qui replace droplater=1 if ticker=="AAV" /* ADVANTAGE ENERGY INCOME FUND, surviving ticker: AVN.U */
qui replace droplater=1 if ticker=="AEZS" /* AETERNA ZENTARIS INC, surviving ticker: AEZ. */
qui replace droplater=1 if ticker=="AEM." /* AGNICO EAGLE MINES LTD, surviving ticker: AEM */
qui replace droplater=1 if ticker=="AGU." /* AGRIUM INC, surviving ticker: AGU */
qui replace droplater=1 if ticker=="AGT." /* AIMGLOBAL TECHNOLOGIES INC, surviving ticker: AIMG */
qui replace droplater=1 if ticker=="AL." /* ALCAN INC, surviving ticker: AL */
qui replace droplater=1 if ticker=="0192B" /* ALDERWOODS GROUP INC, surviving ticker: AWGI */
qui replace droplater=1 if ticker=="0236B" /* ALGOMA STEEL INC, surviving ticker: AGA */
qui replace droplater=1 if ticker=="AAC.NV.B" /* ALLIANCE ATLANTIS COMM -CL B, surviving ticker: AACB */
qui replace droplater=1 if ticker=="AAU" /* ALMADEN MINERALS LTD, surviving ticker: AAM. */
qui replace droplater=1 if ticker=="3251B" /* ALTAIR NANOTECHNOLOGIES INC, surviving ticker: ALTI */
qui replace droplater=1 if ticker=="ANPI" /* ANGIOTECH PHARMACEUTICALS, surviving ticker: ANP. */
qui replace droplater=1 if ticker=="ASW." /* ANGLO SWISS RESOURCES INC, surviving ticker: 3ASWRF */
qui replace droplater=1 if ticker=="AOM." /* ANORMED INC, surviving ticker: AOM */
qui replace droplater=1 if ticker=="ARQ" /* ANOORAQ RESOURCES CORP, surviving ticker: ANO */
qui replace droplater=1 if ticker=="APG" /* APOLLO GOLD CORP, surviving ticker: AGT */
qui replace droplater=1 if ticker=="APQ." /* ASIA PACIFIC RESOURCES LTD, surviving ticker: APQCF */
qui replace droplater=1 if ticker=="ASR." /* ASPEN GROUP RESOURCES CORP, surviving ticker: ASRPF */
qui replace droplater=1 if ticker=="ASV" /* ASPREVA PHARMACEUTICALS CORP, surviving ticker: ASPV */
qui replace droplater=1 if ticker=="AZK" /* AURIZON MINES LTD, surviving ticker: ARZ. */
qui replace droplater=1 if ticker=="APX." /* AUSTRAL PACIFIC ENERGY LTD, surviving ticker: AEN */
qui replace droplater=1 if ticker=="ASM." /* AVINO SILVER&GOLD MINES LTD, surviving ticker: 3ASGMF */
qui replace droplater=1 if ticker=="AZC." /* AZCO MINING INC/DE, surviving ticker: AZMN */
qui replace droplater=1 if ticker=="AXP." /* AXCAN PHARMA INC, surviving ticker: AXCA */
qui replace droplater=1 if ticker=="BCE." /* BCE INC, surviving ticker: BCE */
qui replace droplater=1 if ticker=="BPR." /* BPI INDUSTRIES INC, surviving ticker: BPG */
qui replace droplater=1 if ticker=="BLD." /* BALLARD POWER SYSTEMS INC, surviving ticker: BLDP */
qui replace droplater=1 if ticker=="BAA." /* BANRO CORP, surviving ticker: BAA */
qui replace droplater=1 if ticker=="ABX." /* BARRICK GOLD CORP, surviving ticker: ABX */
qui replace droplater=1 if ticker=="BTI." /* BATTERY TECHNOLOGIES INC, surviving ticker: BTIOQ */
qui replace droplater=1 if ticker=="BI." /* BELL CANADA INTL INC, surviving ticker: BCICF */
qui replace droplater=1 if ticker=="BCE1." /* BELL CANADA, surviving ticker: BCE1 */
qui replace droplater=1 if ticker=="BGO." /* BEMA GOLD CORP, surviving ticker: BGO */
qui replace droplater=1 if ticker=="BEL" /* BENNETT ENVIRONMENTAL INC, surviving ticker: BEV. */
qui replace droplater=1 if ticker=="BR.U" /* BIG ROCK BREWERY INCOME TR, surviving ticker: BRBMF */
qui replace droplater=1 if ticker=="7520B" /* BIOJECT MEDICAL TECHNOL, surviving ticker: BJCT */
qui replace droplater=1 if ticker=="BMD." /* BIRCH MOUNTAIN RESOURCES LTD, surviving ticker: BMD */
qui replace droplater=1 if ticker=="BVF." /* BIOVAIL CORP, surviving ticker: BVF */
qui replace droplater=1 if ticker=="BRA" /* BIOMIRA INC, surviving ticker: BIOM */
qui replace droplater=1 if ticker=="BMM.U" /* BLACK MOUNTAIN CAPITAL CORP, surviving ticker: 3BMMUF */
qui replace droplater=1 if ticker=="BOWFF" /* BOARDWALK REAL ESTATE TRUST, survivin ticker: BEI.U */
qui replace droplater=1 if ticker=="BOW1" /* BOWATER PULP & PAPER, surviving ricker: BOW1. */
qui replace droplater=1 if ticker=="BZO" /* BRAZAURO RESOURCES CORP, surviving ticker: BZOFF */
qui replace droplater=1 if ticker=="BWR." /* BREAKWATER RESOURCES LTD, surviving ticker: 3BWLRF */
qui replace droplater=1 if ticker=="GGG.Z" /* BRONX VENTURES INC, surviving ticker: 3BRXVF */
qui replace droplater=1 if ticker=="BAM.LV.A" /* BROOKFIELD ASSET MANAGEMENT, surviving ticker: BAM */
qui replace droplater=1 if ticker=="BPO" /* BROOKFIELD PROPERTIES CORP, surviving ticker: BPO. */
qui replace droplater=1 if ticker=="CGT" /* CAE INC, surviving ticker: CAE. */
qui replace droplater=1 if ticker=="CFK" /* CE FRANKLIN LTD, surviving ticker: CFT. */
qui replace droplater=1 if ticker=="FLY.SV.A" /* CHC HELICOPTER CORP  -CL A, surviving ticker: FLI */
qui replace droplater=1 if ticker=="HCH." /* MERRILL LYNCH CANADA CP HLDR, surviving ticker: HCH */
qui replace droplater=1 if ticker=="CBJ." /* CAMBIOR INC, surviving ticker: CBJ */
qui replace droplater=1 if ticker=="TTV." /* CABLETEL COMMUNICATIONS CORP, surviving ticker: CCMTF */
qui replace droplater=1 if ticker=="CCO." /* CAMECO CORP, surviving ticker: CCJ */
qui replace droplater=1 if ticker=="CCH." /* CAMPBELL RESOURCES INC, surviving ticker: 3CBLRF */
qui replace droplater=1 if ticker=="CL." /* CANADA LIFE FINANCIAL CORP, surviving ticker: CLU */
qui replace droplater=1 if ticker=="CSW" /* CANADA SOUTHERN PETROLEUM, surviving ticker: CSPLF */
qui replace droplater=1 if ticker=="CNR." /* CANADIAN NATIONAL RAILWAY CO, surviving ticker: CNI */
qui replace droplater=1 if ticker=="CNQ" /* CANADIAN NATURAL RESOURCES, surviving ticker: CNQ. */
qui replace droplater=1 if ticker=="CP." /* CANADIAN PACIFIC RAILWAY LTD, surviving ticker: CP */
qui replace droplater=1 if ticker=="SNG." /* CANADIAN SUPERIOR ENERGY INC, surviving ticker: SNG */
qui replace droplater=1 if ticker=="CVV." /* CANALASKA VENTURES LTD, surviving ticker: 3CVVLF */
qui replace droplater=1 if ticker=="CCM." /* CANARC RESOURCE CORP, surviving ticker: 3CRCUF */
qui replace droplater=1 if ticker=="CGS.NV" /* CANWEST GLOBAL COM  -NVTG, surviving ticker: CWG */
qui replace droplater=1 if ticker=="CDU" /* CARDERO RESOURCE CORP, surviving ticker: CDY */
qui replace droplater=1 if ticker=="CRME" /* CARDIOME PHARMA CORP, surviving ticker: COM */
qui replace droplater=1 if ticker=="CLS.SV" /* CELESTICA INC, surviving ticker: CLS */
qui replace droplater=1 if ticker=="CEF.NV.A" /* CENTRAL FUND CANADA  -CL A, surviving ticker: CEF */
qui replace droplater=1 if ticker=="3250B" /* CENTRAL MINERA CORP, surviving ticker: 3CENMF */
qui replace droplater=1 if ticker=="CERTF" /* CERTICOM CORP, surviving ticker: CIC. */
qui replace droplater=1 if ticker=="CC." /* CHAI NA TA CORP, surviving ticker: 3CCCFF */
qui replace droplater=1 if ticker=="CRW." /* CINRAM INTERNATIONAL INC, surviving ticker: CNRMF */
qui replace droplater=1 if ticker=="CTM." /* CINTECH SOLUTIONS INC, surviving ticker: 3CMGFF */
qui replace droplater=1 if ticker=="CRJ" /* CLAUDE RESOURCES INC, surviving ticker: CGR */
qui replace droplater=1 if ticker=="CLV." /* CLEARLY CDN BEVERAGE CP, surviving ticker: 3CCBEF */
qui replace droplater=1 if ticker=="CDM" /* COEUR D'ALENE MINES CORP, surviving ticker: CDE */
qui replace droplater=1 if ticker=="CSN." /* COGNOS INC, surviving ticker: COGN */
qui replace droplater=1 if ticker=="3ZCCCF" /* COMMERCIAL CONSOLIDATORS CP, surviving ticker: CCZ.1 */
qui replace droplater=1 if ticker=="CMT." /* COMPTON PETROLEUM CORP, surviving ticker: CMZ */
qui replace droplater=1 if ticker=="CNY." /* CONIAGAS RESOURCES LTD, surviving ticker: 3COIGE */
qui replace droplater=1 if ticker=="CMC." /* CONSOLIDATED MERCANTILE INC, surviving ticker: CSLMF */
qui replace droplater=1 if ticker=="3CGREF" /* CORAL GOLD RESOURCES LTD, surviving ticker: CGR. */
qui replace droplater=1 if ticker=="CJR.NV.B" /* CORUS ENTERTAINMENT INC, surviving ticker: CJR */
qui replace droplater=1 if ticker=="BCB" /* COTT CORP QUE, surviving ticker: COT */
qui replace droplater=1 if ticker=="CXS." /* COUNSEL CORP, surviving ticker: CXSNF */
qui replace droplater=1 if ticker=="CRY." /* CRYPTOLOGIC INC, surviving ticker: CRYP */
qui replace droplater=1 if ticker=="KRY." /* CRYSTALLEX INTERNATIONAL CP, surviving ticker: KRY */
qui replace droplater=1 if ticker=="CLG" /* CUMBERLAND RESOURCES LTD, surviving ticker: CLG. */
qui replace droplater=1 if ticker=="0604B" /* CURRENT TECHNOLOGY CORP, surviving ticker: 3CRTCF */
qui replace droplater=1 if ticker=="CQC" /* CUSAC GOLD MINES LTD, surviving ticker: 3CUSIF */
qui replace droplater=1 if ticker=="2158B" /* DALECO RESOURCES CORP, surviving ticker: 3DLOV */
qui replace droplater=1 if ticker=="DTV." /* DATAWAVE SYSTEMS INC, surviving ticker: 3DWVS */
qui replace droplater=1 if ticker=="DMC." /* DATAMIRROR CORP, surviving ticker: DMCX */
qui replace droplater=1 if ticker=="DTGLF" /* DATEC GROUP LTD, surviving ticker: DGL. */
qui replace droplater=1 if ticker=="DTL" /* DECTRON INTERNATIONALE INC, surviving ticker: DECT */
qui replace droplater=1 if ticker=="DNR." /* DENBURY RESOURCES INC, surviving ticker: DNR */
qui replace droplater=1 if ticker=="DSG." /* DESCARTES SYSTEMS GROUP INC, surviving ticker: DSGX */
qui replace droplater=1 if ticker=="DSM." /* DESERT SUN MINING CORP, surviving ticker: DEZ */
qui replace droplater=1 if ticker=="8608B" /* DIAMANT ART CORP, surviving ticker: 3DIAAF */
qui replace droplater=1 if ticker=="9142B" /* DIVERSINET CORP, surviving ticker: 3DVNTF */
qui replace droplater=1 if ticker=="DTC." /* DOMTAR INC, surviving ticker: DTC */
qui replace droplater=1 if ticker=="DII.SV" /* DOREL INDUSTRIES INC, surviving ticker: DIIB */
qui replace droplater=1 if ticker=="DAX" /* DRAXIS HEALTH INC, surviving ticker: DRAX */
qui replace droplater=1 if ticker=="3248B" /* DUSA PHARMACEUTICALS INC, surviving ticker: DUSA */
qui replace droplater=1 if ticker=="DOL." /* DYNAMIC OIL & GAS INC, surviving ticker: DYOLF */
qui replace droplater=1 if ticker=="9624B" /* DYNAMOTIVE ENERGY SYS CORP, surviving ticker: 3DYMTF */
qui replace droplater=1 if ticker=="9198B" /* E DIGITAL CORP, surviving ticker: 3EDIG */
qui replace droplater=1 if ticker=="EGC" /* EG CAPITAL INC, surviving ticker: EGCFF */
qui replace droplater=1 if ticker=="EGO" /* ELDORADO GOLD CORP, surviving ticker: ELD */
qui replace droplater=1 if ticker=="8332B" /* ELEPHANT & CASTLE GROUP INC, surviving ticker: 3PUBSF */
qui replace droplater=1 if ticker=="ECA." /* ENCANA CORP, surviving ticker: ECA */
qui replace droplater=1 if ticker=="ENB." /* ENBRIDGE INC, surviving ticker: ENB */
qui replace droplater=1 if ticker=="ERF.U" /* ENERPLUS RESOURCES FUND, surviving ticker: ERF */
qui replace droplater=1 if ticker=="ENT.U" /* ENTERRA ENERGY TRUST, surviving ticker: EENC */
qui replace droplater=1 if ticker=="ETG." /* ENTREE GOLD INC, surviving ticker: EGI */
qui replace droplater=1 if ticker=="ECG" /* ENVOY COMMUNICATIONS GRP INC, surviving ticker: ECGI */
qui replace droplater=1 if ticker=="EEE.U" /* ESPRIT ENERGY TRUST, surviving ticker: EEEBF */
qui replace droplater=1 if ticker=="EZM" /* EUROZINC MINING CORP, surviving ticker: EZM. */
qui replace droplater=1 if ticker=="EXF.SV" /* EXFO ELECTRO OPTICAL ENGR, surviving ticker: EXFO */
qui replace droplater=1 if ticker=="EXE.SV" /* EXTENDICARE INC  -SVTG, surviving ticker: EXE */
qui replace droplater=1 if ticker=="TPC.Z" /* FEC RESOURCES INC, surviving ticker: 3FECOF */
qui replace droplater=1 if ticker=="FNX." /* FNX MINING CO INC, surviving ticker: FNX */
qui replace droplater=1 if ticker=="FFH" /* FAIRFAX FINANCIAL HOLDINGS, surviving ticker: FFH.SV */
qui replace droplater=1 if ticker=="FHR." /* FAIRMONT HOTELS RESORTS INC, surviving ticker: FHR */
qui replace droplater=1 if ticker=="FAL.LV" /* FALCONBRIDGE LTD, surviving ticker: FAL */
qui replace droplater=1 if ticker=="FTM" /* FANTOM TECHNOLOGIES INC, surviving ticker: FTMTQ */
qui replace droplater=1 if ticker=="FSV.SV" /* FIRSTSERVICE CORP  -SVTG, surviving ticker: FSRV */
qui replace droplater=1 if ticker=="FMI." /* FORBES MEDI-TECH INC, surviving ticker: FMTI */
qui replace droplater=1 if ticker=="FDG.U" /* FORDING CANADIAN COAL TRUST, surviving ticker: FDG */
qui replace droplater=1 if ticker=="FSH.SV" /* FOUR SEASONS HOTELS -LTD VTG, surviving ticker: FS */
qui replace droplater=1 if ticker=="FRG." /* FRONTEER DEVELOPMENT GRP INC, surviving ticker: FRG */
qui replace droplater=1 if ticker=="GSI." /* GSI GROUP INC, surviving ticker: GSIG */
qui replace droplater=1 if ticker=="GRS" /* GAMMON LAKE RESOURCES INC, surviving ticker: GAM. */
qui replace droplater=1 if ticker=="YGA" /* GASTAR EXPLORATION LTD, surviving ticker: GST */
qui replace droplater=1 if ticker=="GAC." /* GEAC COMPUTER CORP LTD, surviving ticker: GEAC */
qui replace droplater=1 if ticker=="GNA." /* GERDAU AMERISTEEL CORP, surviving ticker: GNA */
qui replace droplater=1 if ticker=="GIL." /* GILDAN ACTIVEWEAR INC, surviving ticker: GIL */
qui replace droplater=1 if ticker=="GLG." /* GLAMIS GOLD LTD, surviving ticker: GLG. */
qui replace droplater=1 if ticker=="GGG." /* GLENCAIRN GOLD CORP, surviving ticker: GLE */
qui replace droplater=1 if ticker=="GGB.Z" /* GLOBAL LT TELECOMMUNICATIONS, ticker: GBTI */
qui replace droplater=1 if ticker=="CLP." /* GLOBETECH VENTURES CORP, surviving ticker: 3GTVCF */
qui replace droplater=1 if ticker=="G." /* GOLDCORP INC, surviving ticker: GG */
qui replace droplater=1 if ticker=="GGR." /* GOLDEN GOOSE RESOURCE, surviving ticker: 3GGOSF */
qui replace droplater=1 if ticker=="GSC." /* GOLDEN STAR RESOURCES LTD, surviving ticker: GSS */
qui replace droplater=1 if ticker=="GNC." /* GORAN CAPITAL INC, surviving ticker: GNCN */
qui replace droplater=1 if ticker=="7637B" /* GRANDETEL TECHNOLOGIES INC, surviving ticker: GTTIF */
qui replace droplater=1 if ticker=="GBG" /* GREAT BASIN GOLD LTD, surviving ticker: GBN */
qui replace droplater=1 if ticker=="GIB" /* CGI GROUP INC  -CL A, surviving ticker: GIB.SV.A */
qui replace droplater=1 if ticker=="HTE.U" /* HARVEST ENERGY TRUST, surviving ticker: HTE */
qui replace droplater=1 if ticker=="3269B" /* HEALTHTRAC INC, surviving ticker: HTAC */
qui replace droplater=1 if ticker=="HMSLQ" /* HEMOSOL CORP, surviving ticker: HML. */
qui replace droplater=1 if ticker=="HLG.C" /*HOLLINGER INC, surviving ticker: HLGAF */
qui replace droplater=1 if ticker=="HBG" /* HUB INTERNATIONAL LTD, surviving ticker: HBG. */
qui replace droplater=1 if ticker=="HUM." /* HUMMINGBIRD LTD, surviving ticker: HUMC */
qui replace droplater=1 if ticker=="HYG" /* HYDROGENICS CORP, surviving ticker: HYGA */
qui replace droplater=1 if ticker=="IMR" /* IMA EXPLORATION INC, surviving ticker: IMR. */
qui replace droplater=1 if ticker=="IMG." /* IAMGOLD CORP, surviving ticker: IAG */
qui replace droplater=1 if ticker=="IMX." /* IMAX CORP, surviving ticker: IMAX */
qui replace droplater=1 if ticker=="IGP" /* IMPERIAL GINSENG PRODS LTD, surviving ticker: IGPFF */
qui replace droplater=1 if ticker=="IMO." /* IMPERIAL OIL LTD, surviving ticker: IMO */
qui replace droplater=1 if ticker=="N." /* INCO LTD, surviving ticker: N */
qui replace droplater=1 if ticker=="INP" /* INFOCORP COMPUTER SOLUTIONS, surviving ticker: IFCSF */
qui replace droplater=1 if ticker=="INO" /* INOVIO BIOMEDICAL CORP, surviving ticker: GEB. */
qui replace droplater=1 if ticker=="3IBTGF" /* INTERNATIONAL BARRIER TECH I, surviving ticker: IBH */
qui replace droplater=1 if ticker=="7116B" /* INTL GEMINI TECH INC, surviving ticker: 6971B */
qui replace droplater=1 if ticker=="ITW." /* INTRAWEST CORP, surviving ticker: IDR */
qui replace droplater=1 if ticker=="ITP." /* INTERTAPE POLYMER GROUP INC, surviving ticker: ITP */
qui replace droplater=1 if ticker=="IOL" /* INTEROIL CORP, surviving ticker: IOC */
qui replace droplater=1 if ticker=="IPS." /* IPSCO INC, surviving ticker: IPS */
qui replace droplater=1 if ticker=="ITX" /* ITERATION ENERGY LTD, surviving ticker: ITXFF */
qui replace droplater=1 if ticker=="IE" /* IVANHOE ENERGY INC, surviving ticker: IVAN */
qui replace droplater=1 if ticker=="IVN" /* IVANHOE MINES LTD, surviving ticker: IVN. */
qui replace droplater=1 if ticker=="JCT." /* JEWETT-CAMERON TRADING CO, surviving ticker: JCTCF */
qui replace droplater=1 if ticker=="JSD" /* JONES SODA CO, surviving ticker: JSDA */
qui replace droplater=1 if ticker=="MXB.U" /* KHD HUMBOLDT WEDAG INTL LTD, surviving ticker: KHDH */
qui replace droplater=1 if ticker=="KBR" /* KIMBER RESOURCES INC surviving ticker: KBX */
qui replace droplater=1 if ticker=="K." /* KINROSS GOLD CORP, surviving ticker: KGC */
qui replace droplater=1 if ticker=="KFS" /* KINGSWAY FINANCIAL SVCS INC, surviving ticker: KFS. */
qui replace droplater=1 if ticker=="LMZ." /* LMS MEDICAL SYSTEMS INC, surviving ticker: LMZ */
qui replace droplater=1 if ticker=="KRK" /* LML PAYMENT SYSTEMS INC, surviving ticker: LMLP */
qui replace droplater=1 if ticker=="BUS." /* LAIDLAW INTERNATIONAL INC, surviving ticker: LI */
qui replace droplater=1 if ticker=="LAG" /* LAURION GOLD INC, surviving ticker: LAGFF */
qui replace droplater=1 if ticker=="9008B" /* LEADING BRANDS INC, surviving ticker: LBIX */
qui replace droplater=1 if ticker=="LVN" /* LEVON RESOURCES LTD, surviving ticker: 3LVNVE */
qui replace droplater=1 if ticker=="LIM" /* LIONORE MINING INTL LTD, surviving ticker: 3LMGGF */
qui replace droplater=1 if ticker=="LGF." /* LIONS GATE ENTMT CORP, surviving ticker: LGF */
qui replace droplater=1 if ticker=="LQW" /* LIQUIDATION WORLD INC, surviving ticker: LIQWF */
qui replace droplater=1 if ticker=="LOR." /* LORUS THERAPEUTICS INC, surviving ticker: LRP */
qui replace droplater=1 if ticker=="MDZ.SV.A" /* MDC PARTNERS INC, surviving ticker: MDCA */
qui replace droplater=1 if ticker=="MDZ" /* MDS INC, surviving ticker: MDS. */
qui replace droplater=1 if ticker=="MIM.SV.A" /* MI DEVELOPMENTS INC, surviving ticker: MIM */
qui replace droplater=1 if ticker=="MCZ." /* MAD CATZ INTERACTIVE INC, surviving ticker: MCZ */
qui replace droplater=1 if ticker=="3MMRSF" /* MADISON MINERALS INC, surviving ticker: MMR. */
qui replace droplater=1 if ticker=="MEC.SV.A" /* MAGNA ENTERTAINMENT CORP, surviving ticker: MECA */
qui replace droplater=1 if ticker=="MG.SV.A" /* MAGNA INTERNATIONAL  -CL A, surviving ticker: MGA */
qui replace droplater=1 if ticker=="8627B" /* MAMMA.COM INC, surviving ticker: MAMA */
qui replace droplater=1 if ticker=="MFC." /* MANULIFE FINANCIAL CORP, surviving ticker: MFC */
qui replace droplater=1 if ticker=="3393B" /* MED-EMERG INTERNATIONAL INC, surviving ticker: 3MDER */
qui replace droplater=1 if ticker=="MPH." /* MEDICURE INC, surviving ticker: MCU */
qui replace droplater=1 if ticker=="MNG." /* MERIDIAN GOLD INC, surviving ticker: MDG */
qui replace droplater=1 if ticker=="MR." /* METALLICA RESOURCES INC, surviving ticker: MRB */
qui replace droplater=1 if ticker=="MX." /* METHANEX CORP, surviving ticker: MEOH */
qui replace droplater=1 if ticker=="0455B" /* MICROMEM TECHNOLOGIES INC, surviving ticker: 3MMTIF */
qui replace droplater=1 if ticker=="MGI." /* MIGENIX INC, surviving ticker: 3MGIFF */
qui replace droplater=1 if ticker=="MMM." /* MINCO MINING & METALS CORP, surviving ticker: MMK */
qui replace droplater=1 if ticker=="MFN" /* MINEFINDERS CORP LTD, surviving ticker: MFL. */
qui replace droplater=1 if ticker=="MAE" /* MIRAMAR MINING CORP, surviving ticker: MNG */
qui replace droplater=1 if ticker=="MNT." /* MIRTRONICS INC, surviving ticker: 3MNTCE */
qui replace droplater=1 if ticker=="MPV." /* MOUNTAIN PROVINCE DIAMONDS, surviving ticker: MDM */
qui replace droplater=1 if ticker=="NBS." /* NBS TECHNOLOGIES INC, surviving ticker: NBSFF */
qui replace droplater=1 if ticker=="7518B" /* NGAS RESOURCES INC, surviving ticker: NGAS */
qui replace droplater=1 if ticker=="NQL." /* NQL ENERGY SERVICES INC, surviving ticker: 3NQDRF */
qui replace droplater=1 if ticker=="NRM" /* NEUROCHEM INC, surviving ticker: NRMX */
qui replace droplater=1 if ticker=="NEV." /* NEVADA STAR RESOURCE CORP, surviving ticker: 3NVSRF */
qui replace droplater=1 if ticker=="NSU" /* NEVSUN RESOURCES LTD, surviving ticker: NSU. */
qui replace droplater=1 if ticker=="NGD." /* NEW GOLD INC, surviving ticker: NGD */
qui replace droplater=1 if ticker=="NXY." /* NEXEN INC, surviving ticker: NXY */
qui replace droplater=1 if ticker=="3636B" /* NICHOLAS FINANCIAL INC, surviving ticker: NICK */
qui replace droplater=1 if ticker=="NBD." /* NORBORD INC, surviving ticker: NBDFF */
qui replace droplater=1 if ticker=="NII." /* NORSAT INTL INC, surviving ticker: 3NSATF */
qui replace droplater=1 if ticker=="NT." /* NORTEL NETWORKS CORP, surviving ticker: NT */
qui replace droplater=1 if ticker=="PDL" /* NORTH AMERICAN PALLADIUM, surviving ticker: PAL */
qui replace droplater=1 if ticker=="NDM" /* NORTHERN DYNASTY MINERAL LTD, surviving ticker: NAK */
qui replace droplater=1 if ticker=="NHD" /* NORTHERN HEMISPHERE DEV CP, surviving ticker: 3HSDME */
qui replace droplater=1 if ticker=="NNO." /* NORTHERN ORION RESOURCES INC, surviving ticker: NTO */
qui replace droplater=1 if ticker=="NGX." /* NORTHGATE MINERALS CORP, surviving ticker: NGX */
qui replace droplater=1 if ticker=="NCX." /* NOVA CHEMICALS CORP, surviving ticker: NCX */
qui replace droplater=1 if ticker=="NG." /* NOVAGOLD RESOURCES LTD, surviving ticker: NG */
qui replace droplater=1 if ticker=="3311B" /* NOVAMERICAN STEEL INC, surviving ticker: TONS */
qui replace droplater=1 if ticker=="NVL." /* NOVELIS INC, surviving ticker: NVL */
qui replace droplater=1 if ticker=="NCS." /* NUCRYST PHARM CORP -REDH, surviving ticker: NCST */
qui replace droplater=1 if ticker=="0115B" /* NYMOX PHARMACEUTICAL CORP, surviving ticker: NYMX */
qui replace droplater=1 if ticker=="3OFSYF" /* OFFSHORE SYSTEMS INTL LTD, surviving ticker: OSI. */
qui replace droplater=1 if ticker=="ONC" /* ONCOLYTICS BIOTECH INC, surviving ticker: ONCY */
qui replace droplater=1 if ticker=="OTC" /* OPEN TEXT CORP, surviving ticker: OTEX */
qui replace droplater=1 if ticker=="OPY.NV" /* OPPENHEIMER HLDGS INC  -CL A, surviving ticker: OPY */
qui replace droplater=1 if ticker=="2129B" /* OPTIMAL GROUP INC, surviving ticker: 2129B */
qui replace droplater=1 if ticker=="OZN." /* OREZONE RESOURCES INC, surviving ticker: OZN */
qui replace droplater=1 if ticker=="OTT.U" /* OTELCO INC, suviving ticker: OTT */
qui replace droplater=1 if ticker=="7598B" /* PLC SYSTEMS INC, surviving ticker: PLC */
qui replace droplater=1 if ticker=="PMU." /* PACIFIC RIM MINING CORP, surviving ticker: PMU */
qui replace droplater=1 if ticker=="PAA." /* PAN AMERICAN SILVER CORP, surviving ticker: PAAS */
qui replace droplater=1 if ticker=="PEI." /* PARLAY ENTERTAINMENT INC, surviving ticker: PRYNF */
qui replace droplater=1 if ticker=="PAE.LV"  /* PEACE ARCH ENTMT GROUP INC, surviving ticker: PAE */ 
qui replace droplater=1 if ticker=="PGF.A" /* PENGROWTH ENERGY TRUST, surviving ticker: PGH */
qui replace droplater=1 if ticker=="PCR." /* PERU COPPER INC, surviving ticker: CUP */
qui replace droplater=1 if ticker=="PTQ" /* PETAQUILLA MINERALS LTD, surviving ticker: 3PTQMF */
qui replace droplater=1 if ticker=="PCA." /* PETRO-CANADA, surviving ticker: PCZ */
qui replace droplater=1 if ticker=="PTF.U" /* PETROFUND ENERGY TRUST, surviving ticker: PFT */
qui replace droplater=1 if ticker=="PQU" /* PETROQUEST ENERGY INC, suviving ticker: PQ */
qui replace droplater=1 if ticker=="PDG." /* PLACER DOME INC, surviving ticker: PDG */
qui replace droplater=1 if ticker=="LAN." /* PLAINTREE SYSTEMS INC, surviving ticker: 3LANPF */
qui replace droplater=1 if ticker=="PPK." /* POLYAIR INTER PACK INC, surviving ticker: PPK */
qui replace droplater=1 if ticker=="PYM." /* POLYMER SOLUTIONS INC, surviving ticker: 3PYSU */
qui replace droplater=1 if ticker=="POM." /* POLYMET MINING CORP, surviving ticker: 3POMGF */
qui replace droplater=1 if ticker=="POT." /* POTASH CORP SASK INC, surviving ticker: POT */
qui replace droplater=1 if ticker=="PRP" /* PRAIRIE PACIFIC ENERGY CORP, surviving ticker: 3PRPEF */
qui replace droplater=1 if ticker=="PD.U" /* PRECISION DRILLING TRUST, surviving ticker: PDS */
qui replace droplater=1 if ticker=="PMD." /* PREMD INC, surviving ticker: PME */
qui replace droplater=1 if ticker=="PBI.U" /* PREMIUM BRANDS INCOME FUND, surviving ticker: PRMBF */
qui replace droplater=1 if ticker=="PWI.U" /* PRIMEWEST ENERGY TRUST, surviving ticker: PWI */
qui replace droplater=1 if ticker=="7050B" /* PRINCETON MEDIA GROUP INC, surviving ticker: PMGIF */
qui replace droplater=1 if ticker=="PVE.U" /* PROVIDENT ENERGY TRUST, surviving ticker: PVX */
qui replace droplater=1 if ticker=="QLT" /* QLT INC, surviving ticker: GLTI */
qui replace droplater=1 if ticker=="AAZ" /* QSOUND LABS INC, surviving ticker: QSND */
qui replace droplater=1 if ticker=="QZM" /* QUARTZ MOUNTAIN RESOURCES, surviving ticker: 3QZMRE */
qui replace droplater=1 if ticker=="QBR.SV.B" /* QUEBECOR INC  -CL B, surviving ticker: 3QBCRF */
qui replace droplater=1 if ticker=="IQW.SV" /* QUEBECOR WORLD INC  -SUB VTG, surviving ticker: IQW */
qui replace droplater=1 if ticker=="QRL" /* QUEENSTAKE RES LTD YUKON, surviving ticker: QEE */
qui replace droplater=1 if ticker=="QC" /* QUEST CAPITAL CORP, surviving ticker: QCC */
qui replace droplater=1 if ticker=="GHVRF" /* RED LAKE RESOURCES INC, surviving ticker: RL. */
qui replace droplater=1 if ticker=="RLO." /* REGALITO COPPER CORP, surviving ticker: RLO */
qui replace droplater=1 if ticker=="RGF." /* REPUBLIC GOLDFIELDS, surviving ticker: 3RPGDF */
qui replace droplater=1 if ticker=="RIM" /* RESEARCH IN MOTION LTD, surviving ticker: RIMM */
qui replace droplater=1 if ticker=="RPC." /* REVENUE PROPERTIES CO LTD, surviving ticker: RPCFF */
qui replace droplater=1 if ticker=="RIC." /* RICHMONT MINES INC, surviving ticker: RIC */
qui replace droplater=1 if ticker=="RNO" /* RIO NARCEA GOLD MINES LTD, surviving ticker: RNG */
qui replace droplater=1 if ticker=="RBA." /* RITCHIE BROS AUCTIONEERS INC, surviving ticker: RBS */
qui replace droplater=1 if ticker=="RTI." /* RIVAL TECHNOLOGIES INC, surviving ticker: 3RVTI */
qui replace droplater=1 if ticker=="RE." /* ROCK ENERGY INC, surviving ticker: RENFF */
qui replace droplater=1 if ticker=="RCI.NV.B" /* ROGERS COMMUNICATIONS  -CL B, surviving ticker: RG */
qui replace droplater=1 if ticker=="3591B" /* ROSEDALE DECORATIVE PROD LTD, surviving ticker: ROSD */
qui replace droplater=1 if ticker=="RYG." /* ROYAL GROUP TECHNOLOGIES LTD, surviving ticker: RYG */
qui replace droplater=1 if ticker=="ROY.U" /* ROYSTER-CLARK LTD, surviving ticker: 0912B */
qui replace droplater=1 if ticker=="RMX." /* RUBICON MINERALS CORP, surviving ticker: RBY */
qui replace droplater=1 if ticker=="RSM" /* ROYAL STANDARD MINERALS INC, surviving ticker: 3RYSMF */
qui replace droplater=1 if ticker=="RUS." /* RUSSEL METALS INC, surviving ticker: RUSMF */
qui replace droplater=1 if ticker=="SRXAF" /* S R TELECOM INC, surviving ticker: SRX. */
qui replace droplater=1 if ticker=="9022B" /* SCHMITT INDUSTRIES INC/OR, surviving ticker: SMIT */
qui replace droplater=1 if ticker=="SLP." /* SCINTILORE EXPLORATIONS LTD, surviving ticker: SLPFF */
qui replace droplater=1 if ticker=="SEA." /* SEABRIDGE GOLD INC, surviving ticker: SA */
qui replace droplater=1 if ticker=="3SNSG" /* 3SNSGSENSE TECHNOLOGIES INC, surviving ticker: SSE.Z */
qui replace droplater=1 if ticker=="SVN" /* 724 SOLUTIONS INC, surviving ticker: SVNX */
qui replace droplater=1 if ticker=="SJR" /* SHAW COMMUNICATIONS INC-CL B, surviving ticker: SJR.NV.B */
qui replace droplater=1 if ticker=="SHC." /* SHELL CANADA LTD  -CL A, surviving ticker: 3SCUAF */
qui replace droplater=1 if ticker=="0416B" /* SHEP TECHNOLOGIES INC, surviving ticker: STLOF */
qui replace droplater=1 if ticker=="SW." /* SIERRA WIRELESS INC, surviving ticker: SWIR */
qui replace droplater=1 if ticker=="SWE" /* SILENT WITNESS ENTERPRISES, surviving ticker: SILWF */
qui replace droplater=1 if ticker=="8710B" /* SILVERADO GOLD MINES LTD, surviving ticker: 3SLGLF */
qui replace droplater=1 if ticker=="SSO" /* SILVER STANDARD RES INC, surviving ticker: SSRI */
qui replace droplater=1 if ticker=="SLW" /* SILVER WHEATON CORP, surviving ticker: SLW. */
qui replace droplater=1 if ticker=="SOLI" /* SOLITARIO RESOURCES CORP, surviving ticker: SLR. */
qui replace droplater=1 if ticker=="SDI" /* SPECTRAL DIAGNOSTICS INC, surviving ticker: DIAGF */
qui replace droplater=1 if ticker=="SSY." /* SPECTRUM SIGNAL PROCESSING, surviving ticker: SSPI */
qui replace droplater=1 if ticker=="SXC" /* STANTEC INC, surviving ticker: STN. */
qui replace droplater=1 if ticker=="SLX" /* STELLAR PHARMACEUTICALS INC, surviving ticker: 3SLXCF */
qui replace droplater=1 if ticker=="SGD" /* STERLITE GOLD LTD, surviving ticker: SGDTF */
qui replace droplater=1 if ticker=="SME" /* STORM CAT ENERGY CORP, surviving ticker: SCU */
qui replace droplater=1 if ticker=="SLF." /* SUN LIFE FINANCIAL INC, surviving ticker: SLF */
qui replace droplater=1 if ticker=="SU." /* SUNCOR ENERGY INC, surviving ticker: SU */
qui replace droplater=1 if ticker=="SOY" /* SUNOPTA INC, surviving ticker: STKL */
qui replace droplater=1 if ticker=="TLC" /* TLC VISION CORP, surviving ticker: TLSV */
qui replace droplater=1 if ticker=="TLM." /* TALISMAN ENERGY INC, surviving ticker: TLM */
qui replace droplater=1 if ticker=="TNX" /* TAN RANGE EXPLORATION CP, surviving ticker: TRE */
qui replace droplater=1 if ticker=="TKO." /* TASEKO MINES LTD, surviving ticker: TGB */
qui replace droplater=1 if ticker=="TNC." /* TELESIS NORTH COMMUNICATIONS, surviving ticker: TNCVF */
qui replace droplater=1 if ticker=="TU" /* TELUS CORP, surviving ticker: T.NV */
qui replace droplater=1 if ticker=="TIW." /* TELESYSTEM INTL WIRELESS INC, surviving ticker: TIWIF */
qui replace droplater=1 if ticker=="TEO." /* TESCO CORP, surviving ticker: TESOF */
qui replace droplater=1 if ticker=="TOC." /* THOMSON CORP, surviving ticker: TOC */
qui replace droplater=1 if ticker=="0458B" /* TRANS ORIENT PETROLEUM LTD, surviving ticker: 3TOPLF */
qui replace droplater=1 if ticker=="TAC" /* TRANSALTA CORP, surviving ticker: TA: */
qui replace droplater=1 if ticker=="TRP." /* TRANSCANADA CORP, surviving ticker: TRP */
qui replace droplater=1 if ticker=="TGL." /* TRANSGLOBE ENERGY CORP, surviving ticker: TGA */
qui replace droplater=1 if ticker=="TRZ.1" /* TRIZEC PROPERTIES INC, surviving ticker: TRZ */
qui replace droplater=1 if ticker=="TDR." /* TUDOR CORP LTD, surviving ticker: TDRLF */
qui replace droplater=1 if ticker=="UP" /* ULTRA PETROLEUM CORP, surviving ticker: UPL */
qui replace droplater=1 if ticker=="UVI" /* UNILENS VISION INC, surviving ticker: 3UVICF */
qui replace droplater=1 if ticker=="VAS." /* VASOGEN INC, surviving ticker: VSGN */
qui replace droplater=1 if ticker=="VIR." /* VIREXX MEDICAL CORP, surviving ticker: REX */
qui replace droplater=1 if ticker=="VGZ." /* VIREXX MEDICAL CORPVISTA GOLD CORP, surviving ticker: VGZ */
qui replace droplater=1 if ticker=="3VISRF" /* VISIPHOR CORP, surviving ticker: VIS. */
qui replace droplater=1 if ticker=="VTN." /* VITRAN CORP INC, surviving ticker: VTNC */
qui replace droplater=1 if ticker=="WCS.SV.A" /* WESCAST INDUSTRIES  -CL A, surviving ticker: WCSTF */
qui replace droplater=1 if ticker=="WED" /* WESTAIM CORP, surviving ticker: WEDX */
qui replace droplater=1 if ticker=="WTZ" /* WESTERN SILVER CORP, surviving ticker: WTC */
qui replace droplater=1 if ticker=="9354B" /* WIDECOM GROUP INC, surviving ticker: WIDE */
qui replace droplater=1 if ticker=="WHT." /* WORLD HEART CORP, surviving ticker: WHRT */
qui replace droplater=1 if ticker=="YM" /* YM BIOSCIENCES INC, surviving ticker: YMI */
qui replace droplater=1 if ticker=="YRI" /* YAMANA GOLD INC, surviving ticker: AUY */
qui replace droplater=1 if ticker=="ZIC" /* ZI CORP, surviving ticker: ZICA */
qui replace droplater=1 if ticker=="ZL." /* ZARLINK SEMICONDUCTOR INC, surviving ticker: ZL */
qui replace droplater=1 if ticker=="8115B" /* ZOOM TECHNOLOGIES INC, surviving ticker: ZOOM */
qui replace droplater=1 if ticker=="ZTE" /* ZTEST ELECTRONICS INC, surviving ticker: ZTSTF */
qui replace droplater=1 if ticker=="POC.SV.B" /* PAN-OCEAN ENERGY CORP -CL B, surviving ticker: PNYBF */
qui replace droplater=1 if ticker=="SVS.U" /* SEVEN SEAS PETROLEUM INC, surviving ticker: 3SVSSF */

drop if droplater==1

desc

save "clean_compustat_master.dta", replace

log close

